#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define FOR(i, x, y) for (decay<decltype(y)>::type i=(x), _##i=(y); i<_##i; ++i)
#define FORD(i, x, y) for (decay<decltype(y)>::type i=(x), _##i=(y); i>_##i; --i)
#define zerol
#ifdef zerol
#define dbg(x...) do {cout << #x << "->"; err(x);} while (0)
void err(){cout << endl;}
template< template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v:a) cout << v << ' '; err(x...);}
template<typename T, typename... A>
void err(T a, A... x) {cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif // zerol
typedef vector<int> vi;
typedef vector<LL> vL;
const LL MOD = 1e9+7;
const int MAXN = 1e5+5;
LL bin(LL a, LL b, LL p) {
    LL res = 1;
    for (;b;b>>=1, a=a*a%p)
        if (b & 1) res = res * a % p;
    return res;
}
LL get_inv(LL a, LL p) { return bin(a, p-2, p);}
//typedef double LL;
//double dp[100000][100];
LL dp[MAXN];
int m;

void add(LL &a, LL b) { a = (a+b) %MOD;}
void addd(double &a, double b) { a += b;}

//double check(int n, int m) {
//    double cof = 1.0/m;
//    memset(dp, 0, sizeof(dp));
//    for (int i=1; i<=m; ++i) {
//        dp[1][i] = cof;
//    }
//    for (int i=1; i<n; ++i) {
//        for (int j=2; j<=m; ++j) {
//            if (dp[i][j]) {
//                for (int x=1; x<=m; ++x) {
//                    addd(dp[i+1][__gcd(j, x)], cof*dp[i][j]);
//                }
//            }
//        }
//    }
//    double ans = 0;
//    for (int i=1; i<n; ++i) {
//        ans += i*dp[i][1];
//    }
//    return ans;
//}


bool noprime[MAXN];
vector<int> prime, fac[MAXN];
int mu[MAXN];
void init(int MAXN) {

    for (int i=1; i<MAXN; ++i)
        for (int j=i; j<MAXN; j+=i)
            fac[j].push_back(i);

    mu[1] = 1;
    for (int i=2; i<MAXN; ++i) {
        if (!noprime[i]) {
            prime.push_back(i);
            mu[i] = -1;
        }
        for (int p:prime) {
            LL nextp = p*i;
            if (nextp >= MAXN) break;
            noprime[nextp] = 1;
            if (i%p == 0) {
                mu[nextp] = 0;
                break;
            } else mu[nextp] = -mu[i];
        }
    }
}

LL g(int i, int j) {
}

LL f(int i, int j) {
    int g = i/j;
    int res = 0;
    int sz = fac[g].size();
    for (int k=0; k<sz; ++k) {
        res += mu[fac[g][k]]*(m/fac[g][k]/j);
    }
    return res;
}

int main() {



//    n = 10000;
//    m = 3;
//    check(n, m);
//    for (int j=1; j<=m; ++j) {
//        double ans = 0;
//        for (int i=1; i<=n; ++i) {
//            ans += i*dp[i][j];
//        }
//        printf("%d: %f\n", j, ans);
//    }

    cin >> m;
    init(m+1);
    LL ans = 1, inv = get_inv(m, MOD);
    dp[1] = 1;
//    cout << inv << endl;
    for (int i=2; i<=m; ++i) {
        int sz = fac[i].size();
        for (int j=0; j<sz-1; ++j) {
            dp[i] = (dp[i] + f(i, fac[i][j])*dp[fac[i][j]]%MOD)%MOD;
//            add(dp[i], f(i, fac[i][j])*dp[fac[i][j]]%MOD);
        }
        dp[i] = (dp[i]*inv%MOD+1)%MOD;
        int remain = m-f(i,i);
        dp[i] = dp[i]*m%MOD*get_inv(remain, MOD);
        ans = (ans+dp[i])%MOD;
    }
    ans = ans*inv%MOD;
    cout << ans << endl;
    return 0;
}